Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modeling exercises: Fix submission error and redundant tooltip for AI feedback #9437

Merged

Conversation

LeonWehrhahn
Copy link
Contributor

@LeonWehrhahn LeonWehrhahn commented Oct 7, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Motivation and Context

Prerequisites:

  • The user is working on a modeling exercise with AI feedback generation enabled.

The Problem:

  • When a user submits an updated model after the first AI feedback generation request has been processed, and is still in the modeling editor when the feedback result is returned, submitting the updated model can result in a server error on the first attempt.
  • Additionally, when a user opens the modeling editor and an AI feedback result is present, the editor always displays a tooltip indicating that a new assessment is available.

Description

The submission issue occurs because the new AI feedback result is not correctly associated with the modelingSubmission object on the client-side. This causes the server to assume that no result is linked to the current submission, leading to errors. The PR ensures that the server-side checks for results associated with the modelingSubmission before proceeding, preventing errors.

The PR also prevents the tooltip indicating "New Assessment Available" from appearing unnecessarily for AI-generated preliminary feedback results, improving the user experience by removing the redundant notification.

Steps for Testing

Only Deploy to TS1

Instructor Setup:

  • Create a new modeling exercise with the AI feedback option enabled.
  • Optionally, include grading instructions to guide the assessment.

Student Participation:

  • Log in as a student, submit a solution for the modeling exercise, and request AI feedback. To request AI feedback, click on the "Request AI feedback" button.
  • Go directly back into the modeling editor and wait for the feedback to be completed.

Check:

  • Edit the existing UML diagram and click on submit again. Check if the submission works without getting a server error.

Exam Mode Testing

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

  • New Features

    • Introduced a method to check for existing results by submission ID.
    • Enhanced filtering logic for results based on exercise types, including modeling exercises.
    • Added support for feedback requests for both text and modeling exercises.
    • Improved handling of submission results to ensure only relevant results are included.
    • Expanded functionality to support file upload exercises and modeling exercises.
  • Bug Fixes

    • Improved handling of submission results to exclude null values.
    • Refined logic for displaying assessment notifications based on assessment types.
  • Documentation

    • Updated method documentation to reflect changes in functionality and return values.
  • Tests

    • Expanded test coverage for modeling submissions and feedback requests, including success and failure scenarios.
  • Style

    • Improved code readability and maintainability through refined comments and streamlined logic.

= Enea_Gore and others added 30 commits August 4, 2024 20:33
@LeonWehrhahn LeonWehrhahn changed the title Modeling: Fix Server-Side Submission Error and Redundant Tooltip for AI Feedback in Modeling Exercises Modeling Exercises : Fix Server-Side Submission Error and Redundant Tooltip for AI Feedback Oct 7, 2024
@LeonWehrhahn LeonWehrhahn changed the title Modeling Exercises : Fix Server-Side Submission Error and Redundant Tooltip for AI Feedback Modeling Exercises: Fix Server-Side Submission Error and Redundant Tooltip for AI Feedback Oct 7, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range comments (1)
src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1)

Line range hint 236-249: LGTM! Consider a minor improvement in variable naming.

The new method setNumberOfAffectedSubmissionsPerElement is well-implemented and aligns with the single responsibility principle. It effectively calculates and sets the number of similar elements for a given modeling submission.

Consider renaming the modelElementCount variable in the stream operation to improve clarity:

-elementCounts.stream().map(modelElementCount -> {
+elementCounts.stream().map(elementCount -> {
     SimilarElementCount similarElementCount = new SimilarElementCount();
-    similarElementCount.setElementId(modelElementCount.getElementId());
-    similarElementCount.setNumberOfOtherElements(modelElementCount.getNumberOfOtherElements());
+    similarElementCount.setElementId(elementCount.getElementId());
+    similarElementCount.setNumberOfOtherElements(elementCount.getNumberOfOtherElements());
     return similarElementCount;
 }).collect(Collectors.toSet()));

This change makes it clearer that we're mapping from ModelElementCount to SimilarElementCount.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 1255ae5 and a192afe.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1)

Pattern src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

github-actions bot commented Oct 8, 2024

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Oct 8, 2024
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Oct 8, 2024
@LeonWehrhahn LeonWehrhahn temporarily deployed to artemis-test1.artemis.cit.tum.de October 8, 2024 01:35 — with GitHub Actions Inactive
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range comments (1)
src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1)

Line range hint 228-240: LGTM! Consider adding a brief comment for clarity.

The new method setNumberOfAffectedSubmissionsPerElement is well-implemented and follows good coding practices. It effectively sets the number of potential automatic feedback for each model element.

Consider adding a brief comment before the stream operation to explain the transformation:

// Transform ModelElementCount objects to SimilarElementCount objects
submission.setSimilarElements(elementCounts.stream().map(modelElementCount -> {
    // ... (existing code)
}).collect(Collectors.toSet()));

This addition would enhance code readability and make the purpose of the stream operation more explicit.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between a192afe and d18df7b.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/de/tum/cit/aet/artemis/modeling/service/ModelingSubmissionService.java (1)

Pattern src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

Copy link
Contributor

@undernagruzez undernagruzez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm
also works as expected on ts1

Copy link
Contributor

@EneaGore EneaGore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on ts1. Code also lgtm.

@MaximilianAnzinger MaximilianAnzinger changed the title Modeling Exercises: Fix Server-Side Submission Error and Redundant Tooltip for AI Feedback Modeling exercises: Fix server-side submission error and redundant tooltip for ai feedback Oct 9, 2024
Copy link
Contributor

@ole-ve ole-ve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code

@krusche krusche changed the title Modeling exercises: Fix server-side submission error and redundant tooltip for ai feedback Modeling exercises: Fix submission error and redundant tooltip for AI feedback Oct 12, 2024
@krusche krusche added this to the 7.6.0 milestone Oct 12, 2024
@krusche krusche merged commit d8c99a2 into develop Oct 12, 2024
22 of 29 checks passed
@krusche krusche deleted the feature/modeling-exercises/preliminary-feedback-submission branch October 12, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assessment Pull requests that affect the corresponding module client Pull requests that update TypeScript code. (Added Automatically!) modeling Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

6 participants